package org.example.ioc_demo.Controller;

import org.example.ioc_demo.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
//    属性注入
//    @Autowired
//    private UserService us;

    //构造方法注入
//    @Autowired
//    private UserService us;
//    public UserController(UserService us) {
//        this.us = us;
//    }



    //Setter方法注入
    private UserService us;
    @Autowired
    public void setUs(UserService us) {
        this.us = us;
    }


    public void doController() {
        us.doService();
        System.out.println("do controller...");
    }
}
